<?php

	/**
	 * Elgg header contents
	 * This file holds the header output that a user will see
	 * 
	 * @package Elgg
	 * @subpackage Core

	 * @author Curverider Ltd

	 * @link http://elgg.org/
	 **/
	 
?>

<div id="TopBar">
    <div id="topbar_wrapper">
        <div id="topbar_left"></div>
        <div id="topbar_right">
            <?php echo elgg_view('page_elements/searchbox_locations') ?>
            <?php echo elgg_view('page_elements/searchbox') ?>
        </div>
    </div>
</div>

<div id="page_container">

<div id="page_wrapper">
		
<div id="layout_header">
    
<div id="logo_search_wrapper">    

<div id="logo_wrapper"> 
	<a href="<?php echo $vars['url']; ?>"><img src="<?php echo $vars['url']; ?>mod/cloudy_premium/graphics/logo_main_beta2.png" border="0" width="600px" /></a>
</div>

<!--<div id="searchTop">

</div>-->
    
</div><!-- /#logo_search_wrapper -->
<div class="clearfloat"></div>
<div id="menu_wrapper">


	<!-- display the page title <php echo $vars['config']->sitename; ?>-->
	
	<h1></h1>
				<ul class="sf-menu">
				<li class="current" >
					<?php if (isloggedin()) { ?>
						<a href="<?php echo $vars['url']; ?>pg/dashboard/">My Community</a>	
					<?php } ?>
				</li>
				<li class="current" >
					<?php if (isloggedin()) { ?>	
						<a href="<?php echo $vars['url']; ?>pg/profile/<?php echo $_SESSION['user']->username; ?>">My Profile</a>			
					<?php } ?>
					<ul>
						<?php if (isloggedin()) { ?><li>
							<a href="<?php echo $vars['url']; ?>pg/profile/<?php echo $_SESSION['user']->username; ?>/editicon/">Edit Profile Icon</a>
						</li><?php } ?>
						<?php if (isloggedin()) { ?><li>
							<a href="<?php echo $vars['url']; ?>pg/profile/<?php echo $_SESSION['user']->username; ?>/edit/">Edit Profile Info</a>
						</li><?php } ?>
					</ul>
				</li>
				<li>
					<a href="<?php echo $vars['url']; ?>pg/socialcommerce/all">Browse Products</a>
					<?php if (isloggedin()) { ?><ul>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/socialcommerce/<?php echo $_SESSION['user']->username; ?>/all">All Products</a>
						</li>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/socialcommerce/<?php echo $_SESSION['user']->username; ?>/seller">My Products</a>
						</li>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/socialcommerce/<?php echo $_SESSION['user']->username; ?>/add">Add Product</a>
						</li>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/socialcommerce/<?php echo $_SESSION['user']->username; ?>/category">Browse Categories</a>
						</li>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/socialcommerce/<?php echo $_SESSION['user']->username; ?>/addcategory">Add Category</a>
						</li>
					</ul><?php } ?>
				</li>
				
				<!-- 
				<li class="extend">
					<a href="#">Look up Event</a>
					<?php 
					//main link to be inserted
					// echo $vars['url']; pg/events/all
					?>
					<?php //if (isloggedin()) { ?><ul>
						<li>
							<a href="#">Markets</a>
							<?php 
							//link to be inserted insteand of #
							// echo $vars['url']; pg/events/<?php echo $_SESSION['user']->username; /all
							?>
						</li>
						<li>
							<a href="#">Festivals</a>
						<?php 
						
							//link to be inserted insteand of #
							// echo $vars['url']; pg/events/<?php echo $_SESSION['user']->username; /seller
						?>						
						</li>
						<li>
							<a href="#">whatever else</a>
						<?php 
						
							//link to be inserted insteand of #
							// echo $vars['url']; pg/events/<?php echo $_SESSION['user']->username; /add
						?>				
						</li>

					</ul><?php //} ?>
				</li>
				 -->
				
				
				<?php /*if (isloggedin()) { ?><li class="current">
					<a href="<?php echo $vars['url']; ?>pg/settings/user/<?php echo $_SESSION['user']->username; ?>/">Settings</a>
					<ul>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/settings/plugins/<?php echo $_SESSION['user']->username; ?>/">Edit Your Tools</a>
						</li>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/settings/statistics/<?php echo $_SESSION['user']->username; ?>/">Account Statistics</a>
						</li>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/notifications/personal">Notifications</a>
						</li>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/notifications/group">Group Notifications</a>
						</li>
					</ul>
				</li><?php } ?>	

				<li class="current">
					<a href="<?php echo $vars['url']; ?>mod/blog/everyone.php">Blogs</a>
					<?php if (isloggedin()) { ?><ul>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/blog/<?php echo $_SESSION['user']->username; ?>">Your Blog</a>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/blog/<?php echo $_SESSION['user']->username; ?>/friends/">Friends' Blogs</a>
						</li>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/blog/<?php echo $_SESSION['user']->username; ?>/new/">Write a Blog Post</a>
						</li>
					</ul><?php } ?>
				</li>
				<li class="current">
					<a href="<?php echo $vars['url']; ?>mod/bookmarks/everyone.php">Bookmarks</a>
					<?php if (isloggedin()) { ?><ul>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/bookmarks/<?php echo $_SESSION['user']->username; ?>/add">Add Bookmark</a>
						</li>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/bookmarks/<?php echo $_SESSION['user']->username; ?>/inbox">Bookmarks Inbox</a>
						</li>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/bookmarks/<?php echo $_SESSION['user']->username; ?>/items">Your Bookmarks</a>
						</li>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/bookmarks/<?php echo $_SESSION['user']->username; ?>/friends">Your Friends Bookmarks</a>
						</li>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/bookmarks/<?php echo $_SESSION['user']->username; ?>/bookmarklet">Get Bookmarklet</a>
						</li>
					</ul><?php } ?>
				</li>
				<li class="current">
					<a href="<?php echo $vars['url']; ?>pg/groups/world/">Groups</a>
					<?php if (isloggedin()) { ?><ul>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/groups/new/">Create a New Group</a>
						</li>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/groups/owned/<?php echo $_SESSION['user']->username; ?>">Groups You Own</a>
						</li>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/groups/member/<?php echo $_SESSION['user']->username; ?>">Groups You Are a Member Of</a>
						</li>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/groups/invitations/<?php echo $_SESSION['user']->username; ?>">Group Invitations</a>
						</li>
					</ul><?php } ?>
				</li>
				<li>
					<a href="<?php echo $vars['url']; ?>mod/members/index.php">Members</a>
				</li>
				<li class="current">
					<a href="<?php echo $vars['url']; ?>mod/thewire/everyone.php">The Wire</a>
					<?php if (isloggedin()) { ?><ul>
						<li>
							<a href="<?php echo $vars['url']; ?>pg/thewire/<?php echo $_SESSION['user']->username; ?>">Your Wire Posts</a>
						</li>
					</ul><?php } ?>
				</li>
<?php */?>
				<li class="current" >
					
					<a href="#">More</a>
					
					<ul>
						<?php echo elgg_view("navigation/topbar_tools"); ?>
					</ul>
				</li>
					<?php if (isloggedin()) { ?>
					<?php if ($vars['user']->isAdmin()) { ?>
						<li class="current">
							
							<a href="<?php echo $vars['url']; ?>pg/admin/statistics/">Admin</a>
							
							<ul>
								<li>
									<a href="<?php echo $vars['url']; ?>pg/admin/site/">Site Administration</a>
								</li>
								<li>
									<a href="<?php echo $vars['url']; ?>pg/admin/user/">User Administration</a>
								</li>
								<li>
									<a href="<?php echo $vars['url']; ?>pg/admin/plugins/">Tool Administration</a>
								</li>
								<li>
									<a href="<?php echo $vars['url']; ?>mod/categories/settings.php">Site Categories</a>
								</li>
								<li>
									<a href="<?php echo $vars['url']; ?>pg/defaultwidgets/profile">Default Profile Widgets</a>
								</li>
								<li>
									<a href="<?php echo $vars['url']; ?>pg/defaultwidgets/profile">Default Dashboard Widgets</a>
								</li>
								<li>
									<a href="<?php echo $vars['url']; ?>pg/diagnostics/">System Diagnostics</a>
								</li>
								<li>
									<a href="<?php echo $vars['url']; ?>pg/expages/">External Pages</a>
								</li>
								<li>
									<a href="<?php echo $vars['url']; ?>pg/logbrowser/">Log Browser</a>
								</li>
								<li>
									<a href="<?php echo $vars['url']; ?>pg/defaultprofile/edit/">Replace Profile Fields</a>
								</li>
								<li>
									<a href="<?php echo $vars['url']; ?>pg/reportedcontent/">Reported Content</a>
								</li>
								<li>
									<a href="<?php echo $vars['url']; ?>pg/uservalidationbyemail/admin/">Unvalidated Users</a>
								</li>
							</ul>
						</li>
					<?php } ?>
					<?php } ?>
					
<?php if (isloggedin()) { ?>
<?php if(is_plugin_enabled('messages')){ ?>
<?php

	$num_messages = count_unread_messages();
	if($num_messages){
		$num = $num_messages;
	} else {
		$num = 0;
	}
?>
<?php
	if($num == 0){

?>

<li class="current"><a href="<?php echo $vars['url']; ?>pg/messages/<?php echo get_loggedin_user()->username; ?>" class="privatemessages" >Mail [0]</a></li>
	
<?php
    }else{
?>

<li class="current"><a href="<?php echo $vars['url']; ?>pg/messages/<?php echo get_loggedin_user()->username; ?>" class="privatemessages_new" >Mail [<?php echo $num; ?>]</a></li>
	
<?php
    }
?>

<?php } ?>
<?php } ?>			
				<?php if (isloggedin()) {
					 ?><li><?php 
					 echo elgg_view('output/url', 
					 	array('href' => "{$vars['url']}action/logout", 'text' => elgg_echo('logout'), 'is_action' => TRUE)
					 	); ?></li><?php 
				} else { 
					?><li>
					<a href="<?php echo $vars['url']; ?>">Login/Register</a>
					<?php 
					//echo elgg_view('output/url', 
						//array('href' => "{$vars['url']}action/logout", 'text' => elgg_echo('login'), 'is_action' => TRUE)
						//); ?></li><?php 
				}
				
				//check friend requests
				echo elgg_view('friend_request/topbar');				
				
				?>
			</ul>
</div><!-- /#menu_wrapper -->

</div><!-- /#layout_header -->



<!--
<div id="gears">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="990" height="300" id="clouds" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="<?ph//p echo $vars['url']; ?>mod/cloudy_premium/clouds.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#85c9f0" /><embed src="<?php echo $vars['url']; ?>mod/cloudy_premium/clouds.swf" quality="high" wmode="transparent" bgcolor="#85c9f0" width="990" height="300" name="clouds" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</div> -->


